package com.itheima.Jiuye06;
//未完成
public class KuaiPai {
    public static void main(String[] args) {
        int [] a = {6,1,2,7,9,3,4,5,10,8};
        kuaiPai(a,0,a.length-1);
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]+" ");
        }
    }

    private static void kuaiPai(int[] a, int min, int max) {
        if (max < min){
            return;
        }
        int min0 = min;
        int max0 = max;
        int num = a[0];
        while (min != max){
            while (a[max] >= num && min < max){
                max--;
            }
            while (a[min] <= num && min < max){
                min++;
            }
            int temp = a[max];
            a[max] = a[min];
            a[min] = temp;
        }
           int temp = a[min0];
           a[min0] = a[max];
           a[max] = temp;
           kuaiPai(a,min0,min-1);
           kuaiPai(a,min+1,max0);
    }
}
